package action;

import java.util.Iterator;
import java.util.List;
import java.util.Set;

import org.hibernate.Query;
import org.hibernate.Session;

import po.Address;
import po.User;

import bean.AddressDb;
import bo.HibernateSessionFactory;

public class AddressDeleteAction {

	private int id[];
	private String flag;
	private String alarm;
	
	public String execute(){
		if(id!=null){
			for(int i=0;i<id.length;i++){
				Session session = HibernateSessionFactory.getSession();
				Address a = (Address)session.get(Address.class, id[i]);
				session.delete(a);
				session.beginTransaction().commit();
				session.close();
			}
		}else{
			this.setAlarm("请选择删除的人");
		}
		this.setFlag(flag);
				
		return "addressdelete";
	}

	public int[] getId() {
		return id;
	}

	public void setId(int[] id) {
		this.id = id;
	}

	public String getFlag() {
		return flag;
	}

	public void setFlag(String flag) {
		this.flag = flag;
	}

	public String getAlarm() {
		return alarm;
	}

	public void setAlarm(String alarm) {
		this.alarm = alarm;
	}



}
